import { createRouter, createWebHashHistory } from "vue-router";
import type { RouteRecordRaw } from "vue-router";

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/discover'
  },
  {
    path: "/discover",
    name: "discover",
    redirect: "/discover/recommend",
    component: () => import("@/pages/discover/index.vue"),
    children: [
      {
        path: "recommend",
        name: "recommend",
        component: () => import("@/pages/discover/cpns/recommend/index.vue")
      },
      {
        path: "ranking",
        name: "ranking",
        component: () => import("@/pages/discover/cpns/ranking/index.vue")
      },
      {
        path: "songs",
        name: "songs",
        component: () => import("@/pages/discover/cpns/songs/index.vue")
      },
      {
        path: "djradio",
        name: "djradio",
        component: () => import("@/pages/discover/cpns/djradio/index.vue")
      },
      {
        path: "artist",
        name: "artist",
        component: () => import("@/pages/discover/cpns/artist/index.vue")
      },
      {
        path: "album",
        name: "album",
        component: () => import("@/pages/discover/cpns/album/index.vue")
      }
    ]
  },
  {
    path: '/friend',
    name: 'friend',
    component: () => import("@/pages/friend/index.vue")
  },
  {
    path: '/mine',
    name: 'mine',
    component: () => import("@/pages/mine/index.vue")
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'not-fonud',
    component: () => import("@/pages/not-found/index.vue")
  }
]

const router = createRouter({
  routes,
  history: createWebHashHistory(),
  linkActiveClass: 'link-active'
})

export default router